//轮播
//图片轮播，2秒
// var images = ['syloop-13.jpg', 'syloop-14.jpg', 'syloop-15.jpg', 'syloop-16.jpg', 'syloop-17.jpg', 'syloop-18.jpg']
var index = 0

window.onload = function () {
    //轮播
    // setInterval(function () {
    //     setImage()
    // }, 2000)
    addtuijian()
    addclassify()
    // classify()
}
// function setImage() {
//     var img = document.getElementById('dd_scroll')
//     img.src = 'images/niceloop/' + images[index]
//     index++
//     if (index == 6) {
//         index = 0
//     }
// }
function addtuijian() {
    var strHtml = ''
    for (var i = 0; i < 8; i++) {
        strHtml += `<div class="card cardModtify">
                        <img src="./images/kdy3.jpg" class="card-img-top" alt="...">
                        <div class="card-body">
                            <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                            <p class="card-text">Some quick example text to be bulk of the card's content.</p>
                        </div>
                    </div>`
    }
    document.getElementsByClassName('tuijian_books')[0].innerHTML = strHtml
    document.getElementsByClassName('tuijian_books')[1].innerHTML = strHtml
    document.getElementsByClassName('tuijian_books')[2].innerHTML = strHtml
}
function addclassify() {
    var strHtml = ''
    for (var i = 0; i < 6; i++) {
        strHtml += `<article class="classifybooks">
                            <img src="./images/tuijian1.jpg" alt=" " />
                            <article>书名：<span>格林童话</span></article>
                            <article>定价：￥<span>66</span></article>
                        </article>`
    }
    // document.getElementsByClassName('xiaoshuo')[0].innerHTML = strHtml
    // document.getElementsByClassName('wenxue')[0].innerHTML = strHtml
    // document.getElementsByClassName('yishu')[0].innerHTML = strHtml
    // document.getElementsByClassName('zhuanji')[0].innerHTML = strHtml
    // document.getElementsByClassName('lishi')[0].innerHTML = strHtml
    // document.getElementsByClassName('zhexue')[0].innerHTML = strHtml
    // document.getElementsByClassName('xinli')[0].innerHTML = strHtml
    // document.getElementsByClassName('ertong')[0].innerHTML = strHtml
    // document.getElementsByClassName('qimeng')[0].innerHTML = strHtml
    // document.getElementsByClassName('zhongxiao')[0].innerHTML = strHtml
    // document.getElementsByClassName('waiyu')[0].innerHTML = strHtml
}


// function classify() {
//     var lis = document.getElementsByClassName('subsub')
//     var divs = document.getElementsByClassName('classify')[0].children
//     console.log(divs)
//     for (let i = 0; i < lis.length; i++) {
//         lis[i].onclick = function () {
//             //1.把所有的div的class清空
//             for (var j = 0; j < divs.length; j++) {
//                 divs[j].className = ''
//             }
//             //2.设置和当前li所对应的div，添加class='active'
//             divs[i].className = 'active'
//         }
//     }
// }